<!-- src/components/MyButton.vue -->
<template>
  <el-button :type="type" :size="size" @click="handleClick">
    <slot></slot>
  </el-button>
</template>

<script>
export default {
  name: "MyButton",
  props: {
    type: {
      type: String,
      default: "primary",
    },
    size: {
      type: String,
      default: "medium",
    },
  },
  methods: {
    handleClick() {
      // 触发自定义事件
      this.$emit("click");
      console.log("MyButton clicked!");
    },
  },
};
</script>

<style scoped>
.el-button {
  margin: 10px;
}
</style>
